class Solution
{
public:
    bool checkOverlap(int radius, int xCenter, int yCenter, int x1, int y1, int x2, int y2)
    {
        if (yCenter >= y1 && yCenter <= y2)
        {
            return (xCenter >= x1 - radius) && (xCenter <= x2 + radius);
        }
        if (xCenter >= x1 && xCenter <= x2)
        {
            return (yCenter >= y1 - radius) && (yCenter <= y2 + radius);
        }
        int minXCornerDist = min(abs(x1 - xCenter), abs(x2 - xCenter));
        int minYCornerDist = min(abs(y1 - yCenter), abs(y2 - yCenter));
        return minXCornerDist * minXCornerDist + minYCornerDist * minYCornerDist <= radius * radius;
    }
};